package com.tech.koufu.ui.view;

import com.tech.koufu.MainActivity;
import com.tech.koufu.R;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

public class MenuRightFragment extends Fragment implements OnClickListener{
	
	private View rootView;

	@Override
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 
		if (rootView == null) {
			rootView = inflater.inflate(R.layout.menu_right_layout, container, false);
			initView();
		}
		ViewGroup parent = (ViewGroup) rootView.getParent();
		if (parent != null) {
			parent.removeView(rootView);
		} 
		return rootView; 
	}
	private void initView(){
		rootView.findViewById(R.id.menu_selfStock).setOnClickListener(this);
		rootView.findViewById(R.id.menu_kfCompetition).setOnClickListener(this);
		rootView.findViewById(R.id.menu_stockQuotes).setOnClickListener(this);
		rootView.findViewById(R.id.menu_topranking).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		MainActivity ma = (MainActivity) getActivity();
		ma.menuOnclick(v);
//		 switch (v.getId()) {
//		case R.id.menu_kfCompetition:
//			MainActivity ma = (MainActivity) getActivity();
//			ma.menuOnclick(v);
//			break;
//
//		default:
//			break;
//		}
		
	}

	

}
